package com.yuexunit.operationman.nbsy.module.OperationBeforeAndAfter.ui;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;


import com.yuexunit.operationman.nbsy.R;
import com.yuexunit.operationman.nbsy.base.BaseKJActivity;
import com.yuexunit.operationman.nbsy.config.AppConfig;
import com.yuexunit.operationman.nbsy.module.OperationBeforeAndAfter.ui.fragment.Frag_Operation_AfterVisit;
import com.yuexunit.operationman.nbsy.module.OperationBeforeAndAfter.ui.fragment.Frag_Operation_BeforVisit;

import org.kymjs.kjframe.ui.KJFragment;
import org.kymjs.kjframe.utils.PreferenceHelper;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by chenss on 2017/11/10 0010.
 */

public class Act_OperationBeforeAndAfter_Preview extends BaseKJActivity {

    @Bind(R.id.tv_patient_name)
    TextView tvPatientName;
    @Bind(R.id.tv_patient_sex)
    TextView tvPatientSex;
    @Bind(R.id.tv_patient_visitno)
    TextView tvPatientVisitno;
    @Bind(R.id.tv_patient_disease)
    TextView tvPatientDisease;
    @Bind(R.id.things_before_tv)
    TextView thingsBeforeTv;
    @Bind(R.id.things_before_img)
    ImageView thingsBeforeImg;
    @Bind(R.id.things_after_tv)
    TextView thingsAfterTv;
    @Bind(R.id.things_after_img)
    ImageView thingsAfterImg;

    KJFragment beforeVisit, afterVisit;

    @Override
    public void setRootView() {
        setContentView(R.layout.act_operationbeforeandafter_preview);
        ButterKnife.bind(this);
    }

    @Override
    public void initData() {
        setTitle();
        beforeVisit = new Frag_Operation_BeforVisit();
        afterVisit = new Frag_Operation_AfterVisit();
        changeFragment(R.id.things_content, beforeVisit);
    }

    private void setTitle() {
        tvPatientName.setText(AppConfig.BEFOREANDAFTERBEAN.getObject().getName());
        if (AppConfig.BEFOREANDAFTERBEAN.getObject().getSex().equals("1")) {
            tvPatientSex.setText("男");
        } else if (AppConfig.BEFOREANDAFTERBEAN.getObject().getSex().equals("2")) {
            tvPatientSex.setText("女");
        } else {
            tvPatientSex.setText("不详");
        }
        tvPatientVisitno.setText("住院号" + AppConfig.BEFOREANDAFTERBEAN.getObject().getVisitNo());
        tvPatientDisease.setText(PreferenceHelper.readString(aty, AppConfig.PATIENT_INFO, AppConfig.PATIENT_DISEASE));
    }

    @OnClick({R.id.titlebar_docadvice_img_back, R.id.things_before_ll, R.id.things_after_ll})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.titlebar_docadvice_img_back:
                finish();
                break;
            case R.id.things_before_ll:
                thingsBeforeTv.setTextColor(getResources().getColor(R.color.doc_advice_01));
                thingsBeforeImg.setBackgroundColor(getResources().getColor(R.color.doc_advice_01));
                thingsAfterTv.setTextColor(getResources().getColor(R.color.doc_advice_03));
                thingsAfterImg.setBackgroundColor(getResources().getColor(R.color.doc_advice_05));
                changeFragment(R.id.things_content, beforeVisit);
                break;
            case R.id.things_after_ll:
                thingsBeforeTv.setTextColor(getResources().getColor(R.color.doc_advice_03));
                thingsBeforeImg.setBackgroundColor(getResources().getColor(R.color.doc_advice_05));
                thingsAfterTv.setTextColor(getResources().getColor(R.color.doc_advice_01));
                thingsAfterImg.setBackgroundColor(getResources().getColor(R.color.doc_advice_01));
                changeFragment(R.id.things_content, afterVisit);
                break;
        }
    }
}
